package ctgu.junitTest;

import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import ctgu.java.PhoneBillCaculator;

class PhoneBillCaculatorTest {

	
    @Test
    @Order(2)
    @DisplayName("通话时间小于20")
    void Time2() {
        
        LocalDateTime startingTime = 
            LocalDateTime.of(2021,2,3,12,30,0);
        ZonedDateTime zonedStartTime = 
            startingTime.atZone(ZoneId.of("America/New_York"));
        
        LocalDateTime endingTime = 
            LocalDateTime.of(2021, 2,3,12,50,0);
        ZonedDateTime zonedEndTime = 
            endingTime.atZone(ZoneId.of("America/New_York"));
        
        PhoneBillCaculator billCaculator = new PhoneBillCaculator(zonedStartTime, zonedEndTime);
        
        assertEquals(1, billCaculator.bill());
    }
    
    @Test
    @Order(3)
    @DisplayName("通话时间大于20")
    void Time3() {
        
        LocalDateTime startingTime = 
            LocalDateTime.of(2021,2,3,12,30,0);
        ZonedDateTime zonedStartTime = 
            startingTime.atZone(ZoneId.of("America/New_York"));
        
        LocalDateTime endingTime = 
            LocalDateTime.of(2021, 2,3,12,55,0);
        ZonedDateTime zonedEndTime = 
            endingTime.atZone(ZoneId.of("America/New_York"));
        
        PhoneBillCaculator billCaculator = new PhoneBillCaculator(zonedStartTime, zonedEndTime);
        
        assertEquals(1.5, billCaculator.bill());
    }
    
}
    
